﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Powersource_UnitTests.TestBootstrappers;
using PowersourceUIToolkit;
using UCL.Powersource;
using UCL.Powersource.ViewModels;

namespace Powersource_UnitTests.ViewModels
{
    [TestClass]
    public class ViewModelsLC
    {
        [TestMethod]
        public void LoadAndDispose()
        {
            var bs = BootStrapperLoader.CreateDummyVisualStudio_RealStatMan_RealRepMan_RealTFS_DummyBridge();

            var MainVM = ViewModelLocator.GetViewModel<PowersourceMainViewModel>();
            var ReportingVM = ViewModelLocator.GetViewModel<ReportingViewModel>();
            var CCConductor = new ContentControlConductor(null);
            var IPowersourceExt = PowersourceConnector.GetExtensibilityPoint();
            var statMan=IPowersourceExt.StatisticManager;
            var repMan=IPowersourceExt.ReportingManager;
            bs.Dispose();
            Assert.IsTrue(statMan.IsDisposed,"!statMan.IsDisposed");
            Assert.IsTrue(repMan.IsDisposed,"!repMan.IsDisposed");
            Assert.IsTrue(MainVM.IsDisposed,"!MainVM.IsDisposed");
            Assert.IsTrue(ReportingVM.IsDisposed,"!ReportingVM.IsDisposed");
            Assert.IsTrue(bs.IsDisposed);
            Assert.IsNull(IoC.BuildUp);
            Assert.IsNull(IoC.GetAllInstances);
            Assert.IsNull(IoC.GetInstance);
            
            
        }
    }
}
